package com.glsc.ngateway.common.base.repo.mysql.gateway.ldap;

import com.glsc.ngateway.common.base.domain.mysql.gateway.ldap.UserVisitFlow;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

//import javax.jws.soap.SOAPBinding;

/**
 * @Title: FlowMetaDataMapper
 * @Description: 流程元数据持久化表
 * @author: 张宁
 * @version: 1.0.0
 * @date: 2020/12/21 16:29
 */


@Repository
public interface LdapUserFlowRepo extends JpaRepository<UserVisitFlow, Integer>, JpaSpecificationExecutor<UserVisitFlow> {


    /**
     * @param token
     * @return
     * @Description 通过token 查询用户信息
     */
    UserVisitFlow findByToken(String token);


    @Transactional
    @Modifying
    @Query(value = "update UserVisitFlow u set u.expireTime = :expireTime where u.token = :token")
    void delayExpireTime(Long expireTime, String token);


    @Transactional
    @Modifying
    @Query(value = "update UserVisitFlow u set u.systemId = :systemId where u.token = :token")
    void updateSystemId(String systemId, String token);

}
